import StorageUtil from "./StorageUtil";

export default {

    addPlayList(item){
        let names = '';
        item.artists.forEach(auther => {
            names += auther.name;
        });
        let data = {
            singName:item.name,
            singerName:names,
            singId:item.id,
        };
        this.savePlayList(data);
    },

    savePlayList(item){
        let array = StorageUtil.local.getItem("playList") == null
            ? [] : JSON.parse(StorageUtil.local.getItem("playList"));
        array.push(item);
        StorageUtil.local.setItem("playList",array);
    }

}

